<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <link rel="stylesheet" title="Default" href="http://acm.math.spbu.ru/~sk1/colorer/my.css">

  <script src="http://acm.math.spbu.ru/~sk1/colorer/highlight.js"></script>
  <script src="http://acm.math.spbu.ru/~sk1/colorer/cpp.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
</head>

<body>

<pre><code>
/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.18
 */

#include &lt;cstdio&gt;
#include &lt;cassert&gt;
#include &lt;algorithm&gt;
#include &lt;bitset&gt;

using namespace std;

#define forn(i, n) for (int i = 0; i &lt; (int)(n); i++)

typedef pair &lt;int, int&gt; pii;

const int N = 1000 + 10;

int n, m, curT;
bitset &lt;N&gt; c[N];
int is[N], u[N], t[N], mt[N];
int sn, s[N], pn, p[N];
int bad, cc, used[N], color[N];

inline void relax( int &a, int b )
{
  a = min(a, b);
}

void paint( int v, int col )
{
  if (used[v] == cc)
  {
    bad |= (color[v] != col);
    return;
  }
  used[v] = cc, color[v] = col;
  forn(i, pn)
    if (v != i && c[p[v]][p[i]])
      paint(i, !col);
}


void go( int v, int pr )
{
  u[v] = 1;
  t[v] = mt[v] = curT++;
  s[sn++] = v;
  forn(i, n)
    if (c[v][i] && i != pr)
    {
      if (!u[i])
      {
        int old = sn;
        go(i, v);
        if (mt[i] &gt;= t[v]) // component
        {
          pn = 0;
          while (sn &gt; old)
            p[pn++] = s[--sn];
          p[pn++] = v;
          cc++, bad = 0;
          paint(0, 0);
          if (bad)
            forn(i, pn)
              is[p[i]] = 1;
        }
        relax(mt[v], mt[i]);
      }
      relax(mt[v], t[i]);
    }
}

int main()
{
  while (scanf("%d%d", &n, &m) == 2 && (n || m))
  {
    forn(i, n)
      forn(j, n)
        c[i][j] = 1;
    forn(i, m)
    {
      int x, y;
      scanf("%d%d", &x, &y), x--, y--;
      c[x][y] = c[y][x] = 0;
    }
    forn(i, n)
      is[i] = 0, u[i] = 0;
    curT = 0, sn = 0;
    forn(i, n)
      if (!u[i])
        go(i, -1);
    printf("%d\n", count(is, is + n, 0));
  }
  return 0;
}


</code></pre>

</body>
</html>

<font style="visibility:hidden">
